# Contributor: Milan P. Stanić <mps@arvanta.net>
# Maintainer: Milan P. Stanić <mps@arvanta.net>
pkgname=simavr
pkgver=1.7
pkgrel=1
pkgdesc="lean, mean Atmel AVR simulator "
url="https://github.com/buserror/simavr"
arch="aarch64 ppc64le x86_64" # avr-libs -> gcc-avr -> binutils-avr
license="GPL-3.0-or-later"
options="!check" # tests fails
makedepends="avr-libc freeglut-dev elfutils-dev bash"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/buserror/simavr/archive/v$pkgver.tar.gz"

build() {
	export CFLAGS="$CFLAGS -fPIC -O2 -std=gnu99 -Wno-error=stringop-truncation"
	make RELEASE=1 SIMAVR_VERSION=$pkgver DESTDIR=/usr PREFIX=/usr build-simavr
	make RELEASE=1 SIMAVR_VERSION=$pkgver -C examples/parts
}

check() {
	make RELEASE=1 -C tests
}

package() {
	make RELEASE=1 SIMAVR_VERSION=$pkgver DESTDIR="$pkgdir/usr" PREFIX=/usr install-simavr
}

sha512sums="
49647025d9aae652f975cf67c5ab626f5e9db487fcd6745b88c5b668f25b3b0d5e92dbae672e4f827fd1ae00040885825689b39a85bd6c5ae3e7bf731fb720cc  simavr-1.7.tar.gz
"
